﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
public partial class FileManager_Uploader : System.Web.UI.Page
{
	protected void Page_Load(object sender, EventArgs e)
	{
		AuthenticateFileManager();
	}

	public void AuthenticateFileManager()
	{
		// Note: auth check is set via web.config
	}

	protected void bntUpload_Click(object sender, EventArgs e)
	{
		var path = txtPath.Text.Replace("//", "/");
		if (path.StartsWith("/Root/"))
			path = ConfigurationManager.AppSettings["FileManager"] + path.Substring("/Root/".Length);
		string FilePath = Server.MapPath("~" + path + FileUpload1.FileName);
		FilePath = HttpUtility.UrlDecode(FilePath);
		if (System.IO.File.Exists(FilePath))
		{
			spanerror.InnerHtml = "<br/> " + FileUpload1.FileName + " File Exists ";
		}
		else
		{
			FileUpload1.SaveAs(FilePath);
		}
	}
}